package com.ds.robot.assistant.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ds.robot.assistant.dto.BugConditionDTO;
import com.ds.robot.assistant.entity.BugInfo;
import com.ds.robot.assistant.vo.BugVO;
import com.ds.robot.assistant.vo.TesterBugVO;
import com.ds.robot.assistant.vo.resp.ChartData;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author 15910
 * @description 针对表【bug_info(缺陷信息表)】的数据库操作Mapper
 * @createDate 2024-11-06 09:55:28
 * @Entity com.thrk.robot.assistant.entity.BugInfo
 */
public interface BugInfoMapper extends BaseMapper<BugInfo> {

    /**
     * 根据日期范围查询Bug统计信息
     */
    List<BugVO> selectBugVOList(@Param("accountId") String accountId, @Param("startTime") Long startTime,
                                @Param("endTime") Long endTime);

    /**
     * 根据账号查询Bug天数
     * @param condition
     * @return Map key:bugCount,value:4, key:createDay, value:2024-11-06
     */

    List<Map<String, Object>> selectBugDayCountByCondition(BugConditionDTO condition);

    List<ChartData> selectBugCountByDay(BugConditionDTO condition);

    List<ChartData> selectBugCountByWeek(BugConditionDTO condition);

    // TODO 可以把 字段作为变量传入，合并成一个方法
    List<ChartData> selectCloseBugCountByDay(BugConditionDTO condition);

    List<ChartData> selectCloseBugCountByWeek(BugConditionDTO condition);

    List<TesterBugVO> selectTesterBugVOList(@Param("accountIdList") List<String> accountIdList, @Param("startTime") Long startTime,
                                            @Param("endTime") Long endTime);

    List<Map<String, Object>> selectTesterBugDayCountByCondition(@Param("accountIdList") List<String> accountIdList, @Param("startTime") Long startTime,
                                                                 @Param("endTime") Long endTime);

    //TODO 以后优化

    List<ChartData> selectTesterBugCountByDay(BugConditionDTO condition);

    List<ChartData> selectTesterBugCountByWeek(BugConditionDTO condition);

    // TODO 可以把 字段作为变量传入，合并成一个方法
    List<ChartData> selectTesterCloseBugCountByDay(BugConditionDTO condition);

    List<ChartData> selectTesterCloseBugCountByWeek(BugConditionDTO condition);
}


